package org.manggis.util;

import java.net.URL;

public class ClassUtil {

	public static ClassLoader getClassLoader() {
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = ClassUtil.class.getClassLoader();
        }
        
        return classLoader;
	}

	public static String getAbsoluteResourcePath(String resourcePath) {
		URL resource = ClassUtil.getClassLoader().getResource(resourcePath);
		Assert.notNull(resource, "the given class must not be null.");
		
		return resource.getPath();
	}
	
}
